package com.yilin.tms.core.components.repository;

import com.yilin.tms.core.entity.gps.GpsPoint;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author liuxu :)
 * @version 1.0
 * @date 2022-10-28 0028
 */
@Component
public interface GpsDataRepository extends MongoRepository<GpsPoint, String> {
    @Query(value="{'$and': [{'traceId':?0},{ 'gpsTime':{'$gt':?1}}]}",sort = "{gpsTime:1}")
    List<GpsPoint> findAllPointsByDate(String traceId, String gpsTime);


    @Query (value = "{'traceId':?0}",fields = "{}",sort = "{gpsTime:1}") //-1 表示 desc 1 表示 asc
    List<GpsPoint> findAllPointsByTraceId(String traceId, Pageable var2);
}
